<template>
	<view class="tui-set-box">
		<view class="tui-mtop">
			<u-cell-group>
				<u-cell-item icon="account" title="个人信息"></u-cell-item>
				<u-cell-item icon="error-circle" title="关于我们" value=""  @click="href('/pageA/common/about',false)"></u-cell-item>
			</u-cell-group>
		</view>

		<view class="tui-exit" v-if="vuex_token" @click="ExitUserLogin">
			退出登录
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			//退出登录
			ExitUserLogin(){
				var _this = this
				uni.showModal({
					title: '提示',
					content: '确定退出登录？',
					cancelText: "取消", // 取消按钮的文字
					confirmText: "确认", // 确认按钮的文字
					showCancel: true, // 是否显示取消按钮，默认为 true
					success: (res) => {
						if(res.confirm) {
							_this.$u.vuex('vuex_user', {})
							_this.$u.vuex('vuex_token', '') 
	
							uni.showToast({
								title: '退出成功'
							})
							
							setTimeout(()=>{
								uni.switchTab({
									url: '/pages/my/index'
								})
							},1000)
						} 
					}
				})
			},
			href(url,isNeedLogin = true) {
				if(isNeedLogin){
					if(!this.vuex_token){
						uni.navigateTo({
							url: '/pages/common/login'
						})
						return
					}
				}
				
				uni.navigateTo({
					url: url
				})
			},
			
		}
	}
</script>

<style>
	.tui-set-box {
		padding-bottom: 20rpx;
		color: #333;
	}

	.tui-list-cell {
		display: flex;
		align-items: center;
		padding: 24rpx 30rpx;
		font-size: 28rpx;
		height: 120rpx;
	}

	.tui-info-box {
		font-size: 34rpx;
		display: flex;
		align-items: center;
		padding: 24rpx 30rpx;
		font-size: 28rpx;
		height: 180rpx;
	}

	.tui-avatar {
		width: 140rpx;
		height: 140rpx;
		margin-right: 20rpx;
		border-radius: 50%;
	}

	.tui-mtop {
		margin-top: 30rpx;
	}

	.tui-exit {
		background: #fff;
		width: 100%;
		height: 120rpx;
		line-height: 120rpx;
		text-align: center;
		color: #F54649;
		margin-top: 50rpx;
		font-size: 28rpx;
	}
</style>
